package java1223;

public class Java03 {

    public static void main(String[] args) {

        // Java语言运算符

        // (1)算数
        System.out.println(3 + 2);
        System.out.println(3 - 2);
        System.out.println(3 * 2);
        System.out.println(3 / 2.0);
        System.out.println(3 % 2);

        // (2)比较
        System.out.println(3 > 2);
        System.out.println(3 >= 2);
        System.out.println(3 < 2);
        System.out.println(3 <= 2);
        System.out.println(3 == 2);
        System.out.println(3 != 2);

        // (3)赋值
        int a = 2;
        a += 2;
        a -= 2;
        a *= 2;
        a /= 2;
        a %= 2;
        System.out.println(a);

        // (4)逻辑
        System.out.println(true && false);
        System.out.println(false && true);
        System.out.println(true && true);
        System.out.println(false && false);

        System.out.println(true || false);
        System.out.println(false || true);
        System.out.println(true || true);
        System.out.println(false || false);

        System.out.println(!true);
        System.out.println(!false);

        // (5)自增自减：2
        int k = 2;
        k++;
        System.out.println(k);
        k--;
        System.out.println(k);

        // (6)三目
        int v1 = 3;
        int v2 = 5;
        int max = (v1 > v2) ? v1 : v2;
        System.out.println(max);
    }

}

